//
//  InfoConfig.h
//  InvestNanny
//
//  Created by tracy on 14-9-16.
//  Copyright (c) 2014年 tracy. All rights reserved.
//

#ifndef InvestNanny_InfoConfig_h
#define InvestNanny_InfoConfig_h


#pragma mark - 相关Key & Secret -

#define kAppAppleID    @"1150347396"


#define kOneAPMAppKey       @"28F649EA37A23179EEA50860F274F75B67"

#define kWechatAppKey       @"wx66b2e4caabf73b03"
#define kWechatAppSecret    @"badd797f595eaf84138fafd6258dcdeb"

#define kSinaAppKey         @"3205260591"
#define kSinaAppSecret      @"b2f487023917c7bef516959d2f5f2795"

#define kQQAppKey           @"1105129569"
#define kQQAppSecret        @"UR2A5SfLUGw9gg7X"

#define kJPushAppChannel    @"AppStore"

#define kAboutAppWebsite    @"dacelue.com.cn"
#define kAboutAppEmail      @"touzibaomu@163.com"


#define kUserMD5Key         @"642d8148ab9e2d4e1d87e6ff165ebec4"

#pragma mark - 常量宏定义 -

#define ApplicationDelegate     ((AppDelegate *)[UIApplication sharedApplication].delegate)

#define kRequestFailAlert       [CustomAlertView showWithTitle:nil message:kServiceErrorMsg buttonTitle:kConfirmTitle];

#define kConfirmTitle                   @"确定"

#define kCancelTitle                    @"取消"
#define kServiceErrorMsg                @"数据获取失败，请重试"
#define kServiceNoDataMsg               @"没有更多数据"
#define kNetworkReachFailedError        @"当前网络不可用，请检查网络设置"

#define kListRows       10

#define kGetStkDataInterval 3.0f

#define kMarketCodeSZ   0x5A53
#define kMarketCodeSH   0x4853

#define kSourceReportInfo   1897987 //移动端 研报
#define kSourceVideo    8368488 //移动端 视频

#define kQQClient   @"848849504" //好参谋 VIP4 客服QQ号码

#define PDFCachesFolder @"PDFCachesFolder"
/**
 *  用户相关宏定义
 *
 *  @param
 *
 *  @return
 */

#define kAccountSid             @"account_sid"
#define kDefaultTradeAccId      @"default_trade_acc_id"
#define kDefaultTradeAccStatus  @"default_trade_acc_status"
#define kAccountUserName        @"account_username"
#define kAccountPass            @"account_pass"
#define kAutoLogin              @"auto_login"
#define kUserLoginName          @"user_loginname" //为了自动填充登录输入框

#define SetAccSid(sidNum)       {NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];[userDefault setObject:sidNum forKey:kAccountSid];[userDefault synchronize];}
#define GetAccSid               [[NSUserDefaults standardUserDefaults] objectForKey:kAccountSid]
#define DeleteAccSid            [[NSUserDefaults standardUserDefaults] removeObjectForKey:kAccountSid]

#define SetAccUserName(username)    {NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];[userDefault setObject:username forKey:kAccountUserName];[userDefault synchronize];}
#define GetAccUserName              [[NSUserDefaults standardUserDefaults] objectForKey:kAccountUserName]
#define DeleteAccUserName           [[NSUserDefaults standardUserDefaults] removeObjectForKey:kAccountUserName]

#define SetUserLoginName(name)    {NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];[userDefault setObject:name forKey:kUserLoginName];[userDefault synchronize];}
#define GetUserLoginName()              [[NSUserDefaults standardUserDefaults] objectForKey:kUserLoginName]

#define SetDefaultTradeAccId(id)       {NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];[userDefault setObject:id forKey:kDefaultTradeAccId];[userDefault synchronize];}
#define GetDefaultTradeAccId            [[NSUserDefaults standardUserDefaults] objectForKey:kDefaultTradeAccId]
#define DeleteDefaultTradeAccId            [[NSUserDefaults standardUserDefaults] removeObjectForKey:kDefaultTradeAccId]

#define SetDefTradeAccStatus(status)       {NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];[userDefault setObject:status forKey:kDefaultTradeAccStatus];[userDefault synchronize];}
#define GetDefTradeAccStatus            [[NSUserDefaults standardUserDefaults] objectForKey:kDefaultTradeAccStatus]
#define DelDefTradeAccStatus            [[NSUserDefaults standardUserDefaults] removeObjectForKey:kDefaultTradeAccStatus]

#define SetUserLevelItem(item)       {NSData * archiveData = [NSKeyedArchiver archivedDataWithRootObject:item];NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];[userDefault setObject:archiveData forKey:@"CLevelItem"];[userDefault synchronize];}
#define GetUserLevelItem            [NSKeyedUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:@"CLevelItem"]]
#define DelUserLevelItem            [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"CLevelItem"]


/**
 *  App屏幕及系统宏定义
 *
 *  @param
 *
 *  @return
 */

#define kScreenWidth            [UIScreen mainScreen].bounds.size.width
#define kScreenHeight           [UIScreen mainScreen].bounds.size.height
#define kiPhoneXPortrait   (kScreenHeight == 812)

//软件版本
#define kAppShortVersion        [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleShortVersionString"]

// build 版本
#define kAppBuildVersion        [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleVersion"]

//系统版本
#define kSystemVersion          [[[UIDevice currentDevice] systemVersion] floatValue]

//判断屏幕大小
#define iPhone4Retina           ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone5         ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6         ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6_Plus         ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)



/**
 *  常用block类型定义
 *
 *  @param
 *
 *  @return
 */

typedef void(^CommonIntegerBlock)(NSInteger returnValue);
typedef void(^CommonVoidBlock)(void);
typedef void(^CommonImageBlock)(UIImage *image);
typedef void(^CommonBoolBlock)(BOOL boolValue);
typedef void(^CommonStringBlock)(NSString *stringValue);
typedef void(^CommonDictionaryBlock)(NSDictionary *param);
typedef void(^CommonArrayBlock)(NSArray *param);
typedef void(^CommonDataBlock)(NSData *data);
typedef void(^CommonStructBlock)(char *pHeader, char *result);
typedef void(^CommonIndexPathBlock)(NSIndexPath *indexPath);

typedef void(^CommonDataWithTypeBlock)(NSData *data, NSInteger type);

typedef void(^CommonDoubleArrayBlock)(NSArray *param1, NSArray *param2);

typedef NS_ENUM(NSInteger,kUserLevel) {
    //  -1全部、8800000公开课、8800001开户VIP、8800002贵宾VIP、8800003白金VIP、8800004钻石VIP
    kUserLevelAll = -1,
    kUserLevelPublic = 8800000,
    kUserLevelRegister = 8800001,
    kUserLevelGold = 8800002,
    kUserLevelPretinum = 8800003,
    kUserLevelDiamond = 8800004
};


static NSString *const LiveVideoPlayOrStopNotification = @"LiveVideoPlayOrStopNotification";
static NSString *const LiveVideoPlayOnlyAudioNotification = @"LiveVideoPlayOnlyAudioNotification";


#define kOnlineRewardTimeInterval   30*60

typedef NS_ENUM(NSUInteger, RequestCachePolicy){
    ReturnCacheDataThenLoad = 0,///< 有缓存就先返回缓存，同步请求数据
    ReloadIgnoringLocalCacheData, ///< 忽略缓存，重新请求
    ReturnCacheDataElseLoad,///< 有缓存就用缓存，没有缓存就重新请求(用于数据不变时)
    ReturnCacheDataDontLoad,///< 有缓存就用缓存，没有缓存就不发请求，当做请求出错处理（用于离线模式）
};


//宏配置文件

#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)

#define SCREEN_MAX_LENGTH (MAX(UIScreenWidth, UIScreenHeight))

#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)//iphone5
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)//iphone6
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)//iphone6p

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)//iphone4


//log release不打印
#ifndef __OPTIMIZE__
#define NSLog(...) NSLog(__VA_ARGS__)
#else
#define NSLog(...)
#endif

//设备版本号
#define deviceValue [[[UIDevice currentDevice] systemVersion] floatValue]

#define UIScreenHeight5 568

#define navHeight 44

// tab按钮的宽度
//#define kTabButtonWidth   80
// tab按钮的高度
#define kTabButtonHeight  49

//

#define groupNumbers 9

//左边视图的宽度
#define leftWidth 240

#define UIScreenWidth CGRectGetWidth([[UIScreen mainScreen] bounds])
#define UIScreenHeight CGRectGetHeight([[UIScreen mainScreen] bounds])

//背景颜色RGB
#define basebgColor [UIColor colorWithRed:240.0/255.0 green:240.0/255.0 blue:240.0/255.0 alpha:1.0]
//导航条颜色RGB

#define navColor [UIColor colorWithRed:29.0/255.0 green:35.0/255.0 blue:42.0/255.0 alpha:1.0]

#define navColor2 [UIColor colorWithRed:190.0/255.0 green:190.0/255.0 blue:190.0/255.0 alpha:1.0]

//cell黑色背景
#define cellBgBlackColor        [UIColor colorWithRed:31.0/255.0 green:32.0/255.0 blue:44.0/255.0 alpha:1.0]

//tab颜色RGB
#define tabColor [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0]

//下拉圆圈颜色
#define cirColor [UIColor colorWithRed:255.0/255.0 green:71.0/255.0 blue:0.0/255.0 alpha:1]

//view的线
#define viewlineColor [UIColor colorWithRed:222.0/255.0 green:223.0/255.0 blue:224.0/255.0 alpha:1]

#define viewline2Color [UIColor colorWithRed:200.0/255.0 green:200.0/255.0 blue:200.0/255.0 alpha:1]

#define zaocaiColor [UIColor colorWithRed:30.0/255.0 green:152.0/255.0 blue:250.0/255.0 alpha:1]
#define wucaiColor [UIColor colorWithRed:249.0/255.0 green:154.0/255.0 blue:7.0/255.0 alpha:1]
#define wancaiColor [UIColor colorWithRed:255.0/255.0 green:112.0/255.0 blue:18.0/255.0 alpha:1]
#define jiacaiColor [UIColor colorWithRed:1            73.0/255.0 green:9.0/255.0 blue:52.0/255.0 alpha:1]

#define pi 3.14159265358979323846
#define degreesToRadian(x) (pi * x / 180.0)

#define animateDuration1 0.2

#define scrRatioH(x) (UIScreenWidth == 812?668.0/568.0:x/568.0f)   //横屏下

#define scrRatio UIScreenWidth/320.f//计算屏幕比例大小，以5为模型

#define scrRatio2 (IS_IPHONE_6P?1:1)

#define scrFont (IS_IPHONE_6P?1:0)  //6P上字体大几号

#define IOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0? YES : NO)//IOS8

/*
 16进制的文字颜色转RGB
 */
#define kUIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

#define selectedListColor [UIColor colorWithRed:210.0/255.0 green:210.0/255.0 blue:210.0/255.0 alpha:0.2f]

//昵称最大长度
#define NickMaxByteLength 31

//最终view显示的角度
#define finalAngle 45

//分页请求个数
#define PAGE_NUMBER 10

#define PAGE_NUMBER2 20

////两次提示的默认间隔
#define kDefaultPlaySoundInterval 3.0

#define TAG_HEADER 100  //报文头

#define TAG_BODY 101        //报文内容

#define TAG_HEART 102        //心跳

#define TAG_FIXED_LENGTH_HEADER        1001
#define TAG_RESPONSE_BODY              1002

#define InTableTag 1000
#define headbkTag 2000   //table头部板块tag
#define hsbkTag 3000 //沪深板块tag
#define headbkTitleTag 2200   //table头部板块标题tag
#define headbkPriceTag 2400   //table头部板块当前数字tag
#define headbkZdfTag 2600   //table头部板块当前涨跌幅tag

#define sectionTag 4000   //sectiontag


#define appDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])

//是否登录
#define Default_login [[NSUserDefaults standardUserDefaults] objectForKey:@"login"]

#define Default_userId [[NSUserDefaults standardUserDefaults] objectForKey:@"login_userid"]

#define Default_sid [[NSUserDefaults standardUserDefaults] objectForKey:@"login_sid"]

#define Default_userName [[NSUserDefaults standardUserDefaults] objectForKey:@"login_username"]

#define Default_userAccount [[NSUserDefaults standardUserDefaults] objectForKey:@"login_userAccount"]

#define Default_userPassword [[NSUserDefaults standardUserDefaults] objectForKey:@"login_userPassword"]

#define Default_userHeaderUrl [[NSUserDefaults standardUserDefaults] objectForKey:@"login_userheaderurl"]

#define Default_DeviceToken [[NSUserDefaults standardUserDefaults] objectForKey:@"login_DeviceToken"]

#define Default_userBirthday [[NSUserDefaults standardUserDefaults] objectForKey:@"login_userBirthday"]

#define Default_userHeight [[NSUserDefaults standardUserDefaults] objectForKey:@"login_userHeight"]

#define Default_userWeight [[NSUserDefaults standardUserDefaults] objectForKey:@"login_userWeight"]

#define Default_userRole [[NSUserDefaults standardUserDefaults] objectForKey:@"Default_userRole"]

#define Default_userAdr [[NSUserDefaults standardUserDefaults] objectForKey:@"Default_userAdr"]


//市场分类xml
#define Default_MarketType [[NSUserDefaults standardUserDefaults] objectForKey:@"Default_MarketType"]


#define Default_userSex [[NSUserDefaults standardUserDefaults] objectForKey:@"login_userSex"]


//自选股版本
#define Default_SelfStkVer [[NSUserDefaults standardUserDefaults] objectForKey:@"Default_SelfStkVer"]

#define kMarkMaskSH  @"SH"
#define kMarkMaskSZ  @"SZ"

#define GDTableTag 1000

//蓝色系
#define GlobalBlueColor   [UIColor colorWithRed:58.0 / 255.0 green:112.0 / 255.0 blue:188.0 / 255.0 alpha:1]

// DNS 配置控制域名指向
#define kWebNewsUrlDomain   @"http://www.99live.com"        //@"172.16.250.23:82"

//淘金街正式域名
#define HostIp              @"http://www.qiaojingold.com"//@"http://www.lexinamc.cn"

//涨
#define upColor kUIColorFromRGB(0xff1b30)

//跌
#define downColor kUIColorFromRGB(0x2cba3a)

//平
#define equalColor kUIColorFromRGB(0xadb4c1)

#endif
